﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.Utilities.Dispatcher;
using Workflows.Components.Entities.Distances;

namespace Workflows.Components.Entities.Relations.InferredAssociations
{
    public interface ICollapseCalculator
    {
        event WorkerStatusChanged OnStatusChanged;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="idAttrName"></param>
        /// <param name="collapsedIDAttrName"></param>
        /// <param name="attrMetaDatas"></param>
        /// <param name="attrComparers"></param>
        /// <param name="entities"></param>
        /// <param name="nativeAttrThreshold"></param>
        /// <param name="associativeAttrThreshold"></param>
        /// <param name="collapseScoreThreshold"></param>
        /// <param name="collapsedEntities"></param>
        /// <param name="collapsedInstances"></param>
        void TryCollapse(
            string idAttrName, string collapsedIDAttrName,
            List<AttributeMetaData> attrMetaDatas,
            Dictionary<string, IAttributeDistanceCalcutor> attrComparers,
            Dictionary<string, Entity> entities,
            double nativeAttrThreshold, double associativeAttrThreshold,
            double collapseScoreThreshold,
            ref Dictionary<int, Dictionary<string, double>> collapsedEntities,
            ref Dictionary<int, Dictionary<string, object>> collapsedInstances);

        bool CanCollapse(
            List<AttributeMetaData> attrMetaDatas,
            Dictionary<string, IAttributeDistanceCalcutor> attrComparers,
            double nativeAttrThreshold,
            double associativeAttrThreshold, double collapseScoreThreshold,
            Entity entity1, Entity entity2, ref double similarityScore);

        bool CanMerge(
            Entity entity1, Entity entity2,
            Dictionary<string, AttributeMetaData> attrMetaDatas,
            Dictionary<string, IAttributeDistanceCalcutor> attrComparers,
            List<List<string>> mergeableAttributeNames);
        
    }
}
